<?php
	require_once('db_connect.php');
	
	$query = "select name from category";
	$data = mysqli_query($conn, $query)
		or die('category 가져오는 쿼리 실패');

	$categories = array();
	while ($row = mysqli_fetch_array($data)) {
		$category = array('category' => $row['name']);
		array_push($categories, $category);
	}
	mysqli_close($conn);
	
	$output = json_encode($categories);
	echo $output;	
?>